<% if current_user && !current_user.newbie? %>
<div class="card">
  <div class="card-body">
    <%= link_to t('topics.new_topic'), main_app.new_topic_path(node: @node&.id), class: 'btn btn-primary btn-block' %>
  </div>

  <% if current_user && current_user.has_draft? %>
    <div class="text-center alert alert-warning draft-box">
      <%= link_to  main_app.drafts_user_path(current_user) do %>
        <i class="fa fa-edit"></i> 草稿 <%=	 current_user.draft_size %> 篇
      <% end %>
    </div>
  <% end %>
</div>
<% end %>


<%= raw Setting.topic_index_sidebar_important_ads_html %>

<% cache(["banzhu-new-card",Time.now.strftime("%Y-%m-%d")]) do %>
  <div class="index-locations card">
    <div class="card-header"><%=t("common.banzhu")%> <i class="fas fa-dot-circle" aria-hidden="true"></i></div>
    <div class="card-body location-list" style="text-align:center;">
      <% User.banzhu.limit(10).each do |user| %>
        <span class="name">
          <%
            node_names = Node.where(id: user.node_assignment_ids).pluck(:name).join(', ')
          %>
          <%= link_to(user.fullname, "#{user.login}" ,title: node_names, "data-original-title": node_names, "data-toggle": "tooltip", class: "name") %>
        </span>
      <% end %>
    </div>
  </div>
<% end %>

<% cache(["hot-nodes",Time.now.strftime("%Y-%m-%d")]) do %>
    <div class="index-locations card">
      <div class="card-header"><%=t("common.hot_nodes")%> <i class="fas fa-dot-circle" aria-hidden="true"></i></div>
      <div class="card-body location-list" style="text-align:center;">
        <% Node.hots.limit(10).each do |node| %>
          <span class="name"><%= link_to(node.name, main_app.node_topics_path(node), title: node.name, data: { id: node.id })%></span>
        <% end %>
      </div>
    </div>
<% end %>


<%= render "topics/sidebar_columns" %>

<%= render "topics/sidebar_jobs" %>

<%= render "topics/sidebar_box_tips" %>

<%= raw Setting.topic_index_sidebar_html %>
